package com.unionpay.upyzt.example;

import com.unionpay.upyzt.exception.UpyztException;
import com.unionpay.upyzt.model.AcctDeposit;
import com.unionpay.upyzt.resp.AcctDepositPaginationResp;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.util.HashMap;
import java.util.Map;

/**
 * 母户入金、转账入金、大额订单入金列表查询
 */
public class AcctDepositExample {

    private String balanceAcctId;

    public AcctDepositExample(String balanceAcctId) {
        this.balanceAcctId = balanceAcctId;
    }

    public static void runDemos(String balanceAcctId) throws UpyztException {
        AcctDepositExample acctDepositExample = new AcctDepositExample(balanceAcctId);
        // 母户入金、转账入金、大额订单入金列表查询
        AcctDepositPaginationResp acctDepositPaginationResp = acctDepositExample.retrieveByAcctAndTradeType();
    }

    /**
     * 母户入金、转账入金、大额订单入金列表查询
     *
     * @return 查询入金列表
     */
    public AcctDepositPaginationResp retrieveByAcctAndTradeType() throws UpyztException {
        Map<String, Object> params = new HashMap<>();
        params.put("trade_type", 10);
        params.put("balance_acct_id", balanceAcctId);
        // params.put("start_at", OffsetDateTime.now().toString());
        // params.put("end_at", OffsetDateTime.now().toString());
        // params.put("page", 1);
        // params.put("size", 10);

        System.out.println("------- 母户入金、转账入金、大额订单入金列表查询 -------");
        AcctDepositPaginationResp resp = AcctDeposit.retrieveByAcctAndTradeType(params);
        System.out.println(resp);
        return resp;
    }

}
